package com.desire.codegenerator.filecreate;

import com.baomidou.mybatisplus.generator.config.IFileCreate;
import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
import com.baomidou.mybatisplus.generator.config.rules.FileType;

import java.io.File;

public class FileCreate implements IFileCreate {
    @Override
    public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
        //entity 每次都需要重新生成一遍
        if(filePath.indexOf("entity")>=0){
            return  true;
        }
        File file = new File(filePath);
        if(file.exists()){
            return  false;
        }else {
            return true;
        }
    }
}
